Skip to content

make WiFi.softAP() more robust #1925

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 19, 2018
Merged

Conversation

MarkusAD
Copy link
Contributor

@MarkusAD MarkusAD commented Oct 4, 2018

Make WiFi.softAP() fail less easily, attempt to fix #1924

@luc-github
Copy link
Contributor

IMHO accepting password length< 8 and >0, and ignoring it. is not right, should be failed.

if(!passphrase || strlen(passphrase) < 8) {
        conf.ap.authmode = WIFI_AUTH_OPEN;
        *conf.ap.password = 0;
    }

people think they secure their AP and actually it become open

ESP8266 use code that seems correct to me :

if(passphrase && strlen(passphrase) > 0 && (strlen(passphrase) > 63 || strlen(passphrase) < 8)) {
        // fail passphrase to long or short!
        DEBUG_WIFI("[AP] fail passphrase to long or short!\n");
        return false;
    }

@MarkusAD
Copy link
Contributor Author

MarkusAD commented Oct 4, 2018

The issue with how it was originally written is it fails silently and only returns a bool with no way of knowing why. Also, it should've been checking for strlen(passphrase) > 0 in the test for too long or short, allowing 0 length passphrases to fall through to WIFI_AUTH_OPEN. Added a couple log_e() statements and kept the truncating of long ssid/pass.

@me-no-dev me-no-dev merged commit 14ff311 into espressif:master Nov 19, 2018
@MarkusAD MarkusAD deleted the softAP-mod branch November 20, 2018 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WiFi.softAP("apname", "") not working
3 participants